﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace TeaTask
{
    class Program
    {
        static void Main(string[] args)
        {
            List<Tea> teaList = new List<Tea>();
            string choice = "n";
            do
            {
                Tea tea = new Tea();
                tea.FillTeaInfo();
                teaList.Add(tea);
                Console.Write("Continue? y/n: ");
                choice = Console.ReadLine();
                Console.Clear();
            }
            while (choice == "y");

            string manufacturerFromUser;
            string teaSortFromUser;
            Console.Write("Enter tea manufacturer: ");
            manufacturerFromUser = Console.ReadLine();

            Console.Clear();
            Console.WriteLine("Tea made by {0}", manufacturerFromUser);
            foreach (var tea in teaList)
            {
                if (manufacturerFromUser == tea.teaManufacturer)
                {
                    tea.PrintTeaInfo();
                }
            }

            Console.Write("Chose sort of tea that you want to buy: ");
            teaSortFromUser = Console.ReadLine();
            foreach (var tea in teaList)
            {
                if (manufacturerFromUser == tea.teaManufacturer && teaSortFromUser == tea.teaSort)
                {
                    Console.Write("How many grams of tea you want to buy?: ");
                    int gramsOfTeaFromUser = Int32.Parse(Console.ReadLine());
                    double purchasePrice = gramsOfTeaFromUser * tea.teaPricePer100g / 100;
                    Console.WriteLine("You purchase price is {0:0.##}", purchasePrice);
                }  
            }
        }
    }
}
